#include "xShaderManager.h"
#include "XEngine.h"
#include "xEngineConfig.h"

namespace XE	
{


	xShaderManager* Singleton<xShaderManager>::ms_Singleton = NULL;

	xString	 xShaderManager::Resource_Type = "GPU_Shader";

	xShaderManager::xShaderManager()
	{

		const xEngineConfig& config = XEngine::getSingleton().GetConfig();
		const  xStringVector* Pathlist = config.GetResourceList(xShaderManager::Resource_Type);
		if(Pathlist!=NULL)
		{
			xStringVector::const_iterator it = Pathlist->begin();
			for(;it!=Pathlist->end();++it)
			{
				AddPath(*it);
			}
		}


	}


	bool xShaderManager:: OnDeviceLost()
	{

		xResourceMap::iterator it = 	m_ResourceList.begin();
		xResourceMap::iterator endit = 	m_ResourceList.end();
		for(;it!=endit;++it)
		{
			 it->second->OnDeviceLost();
		}

		return true;
	}


}